<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>角色编辑</title>
<link href="${base}/resource/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resource/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/input.js"></script>
<style type="text/css">
.authorities label {
	min-width: 120px;
	_width: 120px;
	display: block;
	float: left;
	padding-right: 4px;
	_white-space: nowrap;
}
</style>
<script type="text/javascript">
$().ready(function() {

	var $inputForm = $("#inputForm");
	var $selectAll = $("#inputForm .selectAll");
	
	[@flash_message /]
	
	$selectAll.click(function() {
		var $this = $(this);
		var $thisCheckbox = $this.closest("tr").find(":checkbox");
		if ($thisCheckbox.filter(":checked").size() > 0) {
			$thisCheckbox.prop("checked", false);
		} else {
			$thisCheckbox.prop("checked", true);
		}
		return false;
	});
	
	// 表单验证
	$inputForm.validate({
		rules: {
			name: "required",
			authorities: "required"
		}
	});
	
});
</script>
</head>
<body>
	<div class="path">
		<a href="${base}/admin/main.do">首页</a> &raquo; 角色编辑
	</div>
	<form id="inputForm" action="update.do" method="post">
		<input type="hidden" name="id" value="${role.id}" />
		<table class="input">
			<tr>
				<th>
					<span class="requiredField">*</span>角色名称:
				</th>
				<td>
					<input type="text" name="name" class="text" value="${role.name}" maxlength="200" />
				</td>
			</tr>
			<tr>
				<th>
					备注:
				</th>
				<td>
					<input type="text" name="description" class="text" value="${role.description}" maxlength="200" />
				</td>
			</tr>
			<tr>
				<td colspan="2">
					&nbsp;
				</td>
			</tr>
            <tr class="authorities">
                <th>
                    <a href="javascript:;" class="selectAll" title="${message("admin.role.selectAll")}">其他</a>
                </th>
                <td>
					<span class="fieldSet">
						<label>
                            <input type="checkbox" name="authorities" value="admin:profile"[#if role.authorities?seq_contains("admin:profile")] checked="checked"[/#if] />个人设置
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:base"[#if role.authorities?seq_contains("admin:base")] checked="checked"[/#if] />后台访问
                        </label>
					</span>
                </td>
            </tr>
            <tr class="authorities">
                <th>
                    <a href="javascript:;" class="selectAll" title="${message("admin.role.selectAll")}">系统</a>
                </th>
                <td>
					<span class="fieldSet">
						<label>
                            <input type="checkbox" name="authorities" value="admin:setting" [#if role.authorities?seq_contains("admin:setting")] checked="checked"[/#if]/>系统设置
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:role" [#if role.authorities?seq_contains("admin:role")] checked="checked"[/#if]/>角色
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:operator" [#if role.authorities?seq_contains("admin:operator")] checked="checked"[/#if]/>管理员
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:smsTemplate" [#if role.authorities?seq_contains("admin:smsTemplate")] checked="checked"[/#if]/>短信模板
                        </label>
                        <label>
                            <input type="checkbox" name="authorities" value="admin:area" [#if role.authorities?seq_contains("admin:area")] checked="checked"[/#if]/>地区
                        </label>
                        <label>
                            <input type="checkbox" name="authorities" value="admin:storage_plugin" [#if role.authorities?seq_contains("admin:storage_plugin")] checked="checked"[/#if]/>存储插件
                        </label>
                        <label>
                            <input type="checkbox" name="authorities" value="admin:druid" [#if role.authorities?seq_contains("admin:druid")] checked="checked"[/#if] />Druid监控
                        </label>
					</span>
                </td>
            </tr>
            <tr class="authorities">
                <th>
                    <a href="javascript:;" class="selectAll" title="${message("admin.role.selectAll")}">业务管理</a>
                </th>
                <td>
					<span class="fieldSet">
						<label>
                            <input type="checkbox" name="authorities" value="admin:member" [#if role.authorities?seq_contains("admin:member")] checked="checked"[/#if]/>用户管理
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:tradeRecord" [#if role.authorities?seq_contains("admin:tradeRecord")] checked="checked"[/#if]/>用户管理
                        </label>
						  <label>
                             <input type="checkbox" name="authorities" value="admin:ad_position" [#if role.authorities?seq_contains("admin:ad_position")] checked="checked"[/#if]/>广告位
                         </label>
							 <label>
                                 <input type="checkbox" name="authorities" value="admin:factory" [#if role.authorities?seq_contains("admin:factory")] checked="checked"[/#if]/>[精选]厂商
                             </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:article" [#if role.authorities?seq_contains("admin:article")] checked="checked"[/#if]/>资讯新闻
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:static" [#if role.authorities?seq_contains("admin:static")] checked="checked"[/#if]/>静态化
                        </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:sms" [#if role.authorities?seq_contains("admin:sms")] checked="checked"[/#if]/>静态化
                        </label>
					</span>
                </td>
            </tr>
            <tr class="authorities">
                <th>
                    <a href="javascript:;" class="selectAll" title="${message("admin.role.selectAll")}">夺宝管理</a>
                </th>
                <td>
					<span class="fieldSet">
						<label>
                            <input type="checkbox" name="authorities" value="admin:dbProduct" [#if role.authorities?seq_contains("admin:dbProduct")] checked="checked"[/#if]/>夺宝商品
                        </label>
						 <label>
                             <input type="checkbox" name="authorities" value="admin:dbOrder" [#if role.authorities?seq_contains("admin:dbOrder")] checked="checked"[/#if]/>夺宝订单
                         </label>
						<label>
                            <input type="checkbox" name="authorities" value="admin:dbTimes" [#if role.authorities?seq_contains("admin:dbTimes")] checked="checked"[/#if]/>夺宝期数
                        </label>
					</span>
                </td>
            </tr>
			[#if role.isSystem]
				<tr>
					<th>
						&nbsp;
					</th>
					<td>
						<span class="tips">${message("admin.role.editSystemNotAllowed")}</span>
					</td>
				</tr>
			[/#if]
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="提交"[#if role.isSystem] disabled="disabled"[/#if] />
					<input type="button" class="button" value="返回" onclick="location.href='list.do'" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>